import { Router, Request, Response } from "express";
import User from '../../db/models/user'

const router = Router()
interface Item {
  age: number,
  name: string,
  sex: string
}
type List = Array<Item>

const appList: List = [
  {
    age: 22,
    name: 'Tom',
    sex: '男',
  },

  {
    age: 23,
    name: 'Tom',
    sex: '男',
  },

  {
    age: 32,
    name: 'Tom',
    sex: '女',
  },

  {
    age: 12,
    name: 'Tom',
    sex: '男',
  },

]
// 有个问题，express.router 直接使用async函数，好像有问题，我这里还没发现，先用着
// 如果 想改可以用之前项目const asyncHandler = require('express-async-handler');包装一下
router.get('/apps', User.getUser)
router.post('/apps', User.createUser)
router.put('/apps', User.editUser)
router.delete('/apps', User.deleteUser)

export default router;